"use client";

import type * as React from "react";

import { insertInlineEquation } from "@platejs/math";
import { RadicalIcon } from "lucide-react";
import { useEditorRef } from "platejs/react";

import { ToolbarButton } from "./toolbar";

export function InlineEquationToolbarButton(
  props: React.ComponentProps&lt;typeof ToolbarButton&gt;,
) {
  const editor = useEditorRef();

  return (
    &lt;ToolbarButton
      {...props}
      onClick={() =&gt; {
        insertInlineEquation(editor);
      }}
      tooltip="Mark as equation"
    &gt;
      &lt;RadicalIcon /&gt;
    &lt;/ToolbarButton&gt;
  );
}
